﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Master/Site.master" AutoEventWireup="false" ValidateRequest="false"
    CodeFile="MyCampaign.aspx.vb" Inherits="private_secure_members_manage_MyCampaign" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <style type="text/css">
        .style1
        {
            width: 545px;
        }
        .style6
        {
            width: 153px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        Manage My Campaign(s)</h2>
        <hr />
    <table style="width: 100%;">
        <tr>
            <td class="style1">
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td valign="top" class="style1">
                Choose an Organisation/Business:<br />
                <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
                    Width="209px" >
                </asp:DropDownList>
                <asp:Button ID="Button1" runat="server" Text="New Campaign" Visible="false" />
                <asp:ObjectDataSource ID="MyEntityODS" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="LogginsLogDSTableAdapters.usp_GetPersonEntityListByPersonIdTableAdapter">
                    <SelectParameters>
                        <asp:Parameter DbType="Guid" Name="UserId" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:ObjectDataSource ID="MyEntityODS0" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="LogginsLogDSTableAdapters.usp_GetPersonAssociateEntityListByPersonIdTableAdapter">
                    <SelectParameters>
                        <asp:Parameter DbType="Guid" Name="UserId" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </td>
            <td>
                &nbsp;</td>
            <td>
            </td>
        </tr>
        <tr>
            <td valign="top" class="style1">
                &nbsp;
            </td>
            <td>
                &nbsp;</td>
            <td>
            </td>
        </tr>
        <tr>
            <td valign="top" class="style1">
                Here are the <strong>Campaign(s)</strong> for your business &nbsp; 
                <asp:HyperLink ID="HyperLink1" runat="server" Text="Manage Your List(s)" 
                    NavigateUrl="~/private/secure_members/manage/MyTargetList.aspx"></asp:HyperLink>
                <br />
                <br />
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id,EntityId"
                    AllowPaging="True" AllowSorting="True" DataSourceID="SqlDataSource1" 
                    CellPadding="4" ForeColor="#333333" 
                    
                    EmptyDataText="There are no campaigns yet for your business. Click &lt;b&gt;New Campaign&lt;/b&gt; button to get started." 
                    Width="517px">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        <asp:BoundField DataField="RowNum" HeaderText="Id" SortExpression="RowNum"
                            ReadOnly="True" Visible="False"></asp:BoundField>
                        <asp:BoundField DataField="Id" HeaderText="Id" InsertVisible="False" 
                            ReadOnly="True" SortExpression="Id" Visible="False" />
                        <asp:BoundField DataField="EntityName" HeaderText="Entity Name" 
                            SortExpression="EntityName" Visible="False" />
                        <asp:BoundField DataField="CampaignType" HeaderText="Campaign Type" 
                            SortExpression="CampaignType" />
                        <asp:BoundField DataField="MessageType" HeaderText="Message Type" 
                            SortExpression="MessageType" />
                        <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                        <asp:BoundField DataField="Note" HeaderText="Note" SortExpression="Note" />
                        <asp:BoundField DataField="DateCreated" HeaderText="Created" 
                            SortExpression="DateCreated"></asp:BoundField>
                        <asp:BoundField DataField="EntityId" HeaderText="EntityId" 
                            SortExpression="EntityId" Visible="False" />
                        <asp:BoundField DataField="CampaignTypeId" HeaderText="CampaignTypeId" 
                            SortExpression="CampaignTypeId" Visible="False" />
                        <asp:BoundField DataField="MessageTypeId" HeaderText="MessageTypeId" 
                            SortExpression="MessageTypeId" Visible="False" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <EmptyDataTemplate>
                        Please Choose an Organisation/Entity from the list above. If you have not yet 
                        created a Campaign you can get started by clicking the <strong>New Campaign</strong> 
                        button below.
                        <asp:LinkButton ID="Button5" runat="server"  
                          CausesValidation="False" CommandName="NewCampaign" Text="New Campaign" />
                                    
                    </EmptyDataTemplate>
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                    DeleteCommand="usp_UserCampaignDelete" DeleteCommandType="StoredProcedure" InsertCommand="usp_UserCampaignInsert"
                    InsertCommandType="StoredProcedure" 
                    SelectCommand="usp_UserCampaignSelect_GRID" SelectCommandType="StoredProcedure"
                    UpdateCommand="usp_UserCampaignUpdate" UpdateCommandType="StoredProcedure">
                    <DeleteParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="CampaignTypeId" Type="Byte" />
                        <asp:Parameter Name="MessageTypeId" Type="Byte" />
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Note" Type="String" />
                        <asp:Parameter Name="DateCreated" Type="DateTime" />
                        <asp:Parameter Name="Active" Type="Boolean" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="DropDownList1" Name="EntityId" PropertyName="SelectedValue"
                            Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Id" Type="Int32" />
                        <asp:Parameter Name="EntityId" Type="Int32" />
                        <asp:Parameter Name="CampaignTypeId" Type="Byte" />
                        <asp:Parameter Name="MessageTypeId" Type="Byte" />
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Note" Type="String" />
                        <asp:Parameter Name="DateCreated" Type="DateTime" />
                        <asp:Parameter Name="Active" Type="Boolean" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <asp:HiddenField ID="HiddenField1" runat="server" />
                <asp:HiddenField ID="HiddenField2" runat="server" />
                <br />
                Run, Stop, Pause, Continue, ...</td>
            <td valign="top">
            <asp:Panel ID="PanelTabHolder" runat="server" Visible="false">
            <strong>Selected Campaign Details</strong>
                <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" 
                    Width="350px">
                    <asp:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
                        <HeaderTemplate>
                            Modify Campaign</HeaderTemplate>
                        <ContentTemplate>
                            <asp:Panel ID="Panel2" runat="server" Visible="False">
                                <table style="width: 100%;">
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Type:
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource5"
                                                DataTextField="Name" DataValueField="Id" Width="204px" 
                                                >
                                                
                                            </asp:DropDownList>
                                            <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                                SelectCommand="usp_lkp_CampaignTypeSelect_ALL" SelectCommandType="StoredProcedure">
                                            </asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Message Type:</td>
                                        <td>
                                            <asp:DropDownList ID="ddlMessageType0" runat="server" 
                                                DataSourceID="SqlDataSource7" DataTextField="Name" DataValueField="Id">
                                            </asp:DropDownList>
                                            <asp:SqlDataSource ID="SqlDataSource7" runat="server" 
                                                ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                                SelectCommand="usp_lkp_MessageTypeSelect_ALL" 
                                                SelectCommandType="StoredProcedure"></asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Name:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtNameUpdate" runat="server" Width="147px"></asp:TextBox>
                                            <br />
                                            <asp:Label ID="Label3" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Note:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtNoteUpdate" runat="server" Width="186px" Height="127px" 
                                                TextMode="MultiLine"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6">
                                        </td>
                                        <td>
                                            <asp:Button ID="Button3" runat="server" Text="Update" /><asp:Button ID="Button4"
                                                runat="server" Text="Cancel" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6">
                                            &#160;
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="CheckBox2" runat="server" Checked="True" Style="visibility: hidden" /><asp:SqlDataSource
                                                ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                                DeleteCommand="usp_UserCampaignDelete" DeleteCommandType="StoredProcedure" InsertCommand="usp_UserCampaignInsert"
                                                InsertCommandType="StoredProcedure" SelectCommand="usp_UserCampaignSelect" SelectCommandType="StoredProcedure"
                                                UpdateCommand="usp_UserCampaignUpdate" UpdateCommandType="StoredProcedure">
                                                <DeleteParameters>
                                                    <asp:Parameter Name="Id" Type="Int32" />
                                                </DeleteParameters>
                                                <InsertParameters>
                                                    <asp:Parameter Name="EntityId" Type="Int32" />
                                                    <asp:Parameter Name="CampaignTypeId" Type="Byte" />
                                                    <asp:Parameter Name="MessageTypeId" Type="Byte" />
                                                    <asp:Parameter Name="Name" Type="String" />
                                                    <asp:Parameter Name="Note" Type="String" />
                                                    <asp:Parameter Name="DateCreated" Type="DateTime" />
                                                    <asp:Parameter Name="Active" Type="Boolean" />
                                                </InsertParameters>
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="DropDownList1" Name="EntityId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                                <UpdateParameters>
                                                    <asp:Parameter Direction="ReturnValue" Name="RETURN_VALUE" Type="Int32" />
                                                    <asp:ControlParameter ControlID="HiddenField1" Name="Id" PropertyName="Value" 
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="txtEntityIdUpdate" Name="EntityId" 
                                                        PropertyName="Text" Type="Int32" />
                                                    <asp:ControlParameter ControlID="DropDownList2" Name="CampaignTypeId" 
                                                        PropertyName="SelectedValue" Type="Byte" />
                                                    <asp:ControlParameter ControlID="ddlMessageType0" Name="MessageTypeId" 
                                                        PropertyName="SelectedValue" Type="Byte" />
                                                    <asp:ControlParameter ControlID="txtNameUpdate" Name="Name" PropertyName="Text" 
                                                        Type="String" />
                                                    <asp:ControlParameter ControlID="txtNoteUpdate" Name="Note" PropertyName="Text" 
                                                        Type="String" />
                                                    <asp:ControlParameter ControlID="txtDateUpdate" Name="DateCreated" 
                                                        PropertyName="Text" Type="DateTime" />
                                                    <asp:Parameter DefaultValue="True" Name="Active" Type="Boolean" />
                                                </UpdateParameters>
                                            </asp:SqlDataSource>
                                            <asp:TextBox ID="txtDateUpdate" runat="server" Style="visibility: hidden" Width="147px"></asp:TextBox><asp:TextBox
                                                ID="txtEntityIdUpdate" runat="server" Style="visibility: hidden" Width="147px"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </ContentTemplate>
                    </asp:TabPanel>
                    <asp:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
                        <HeaderTemplate>
                            Add Campaign</HeaderTemplate>
                        <ContentTemplate>
                            <asp:Panel ID="Panel1" runat="server" Visible="False" Width="330px">
                                <table style="width: 100%;">
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Type:
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlTypeId" runat="server" DataSourceID="SqlDataSource4" DataTextField="Name"
                                                DataValueField="Id" Width="204px" AutoPostBack="True" 
                                               >
                                            </asp:DropDownList>
                                            <asp:Label ID="Label5" runat="server" Text=""></asp:Label>
                                            <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                                SelectCommand="usp_lkp_CampaignTypeSelect_ALL" SelectCommandType="StoredProcedure">
                                            </asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Message Type:
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlMessageType" runat="server" DataSourceID="SqlDataSource6"
                                                DataTextField="Name" DataValueField="Id">
                                            </asp:DropDownList>
                                            <br />
                                            <asp:Label ID="Label4" runat="server"></asp:Label>
                                            <asp:SqlDataSource ID="SqlDataSource6" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                                SelectCommand="usp_lkp_MessageTypeSelect_ALL" SelectCommandType="StoredProcedure">
                                            </asp:SqlDataSource>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Name:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtName" runat="server" Width="147px"></asp:TextBox>
                                            <br />
                                            <asp:Label ID="Label2" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6" valign="top">
                                            Campaign Note:
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtNote" runat="server" Width="186px" Height="127px" 
                                                TextMode="MultiLine"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6">
                                        </td>
                                        <td>
                                            <asp:Button ID="Button2" runat="server" Text="Insert" />
                                            <asp:Label ID="Label1" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style6">
                                            &#160;
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="CheckBox1" runat="server" Checked="True" Style="visibility: hidden" /><asp:SqlDataSource
                                                ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ApplicationServices %>"
                                                DeleteCommand="usp_UserCampaignDelete" DeleteCommandType="StoredProcedure" InsertCommand="usp_UserCampaignInsert"
                                                InsertCommandType="StoredProcedure" SelectCommand="usp_UserCampaignSelect" SelectCommandType="StoredProcedure"
                                                UpdateCommand="usp_UserCampaignUpdate" UpdateCommandType="StoredProcedure">
                                                <DeleteParameters>
                                                    <asp:Parameter Name="Id" Type="Int32" />
                                                </DeleteParameters>
                                                <InsertParameters>
                                                    <asp:ControlParameter ControlID="txtEntityId" Name="EntityId" PropertyName="Text"
                                                        Type="Int32" />
                                                    <asp:ControlParameter ControlID="ddlTypeId" Name="CampaignTypeId" PropertyName="SelectedValue"
                                                        Type="Byte" />
                                                    <asp:ControlParameter ControlID="ddlMessageType" Name="MessageTypeId" 
                                                        PropertyName="SelectedValue" Type="Byte" />
                                                    <asp:ControlParameter ControlID="txtName" Name="Name" PropertyName="Text" Type="String" />
                                                    <asp:ControlParameter ControlID="txtNote" Name="Note" PropertyName="Text" Type="String" />
                                                    <asp:ControlParameter ControlID="txtDate" Name="DateCreated" PropertyName="Text"
                                                        Type="DateTime" />
                                                    <asp:ControlParameter ControlID="CheckBox1" Name="Active" PropertyName="Checked"
                                                        Type="Boolean" />
                                                </InsertParameters>
                                                <SelectParameters>
                                                    <asp:ControlParameter ControlID="DropDownList1" Name="EntityId" PropertyName="SelectedValue"
                                                        Type="Int32" />
                                                </SelectParameters>
                                                <UpdateParameters>
                                                    <asp:Parameter Name="Id" Type="Int32" />
                                                    <asp:Parameter Name="EntityId" Type="Int32" />
                                                    <asp:Parameter Name="CampaignTypeId" Type="Byte" />
                                                    <asp:Parameter Name="MessageTypeId" Type="Byte" />
                                                    <asp:Parameter Name="Name" Type="String" />
                                                    <asp:Parameter Name="Note" Type="String" />
                                                    <asp:Parameter Name="DateCreated" Type="DateTime" />
                                                    <asp:Parameter Name="Active" Type="Boolean" />
                                                </UpdateParameters>
                                            </asp:SqlDataSource>
                                            <asp:TextBox ID="txtDate" runat="server" Style="visibility: hidden" Width="147px"></asp:TextBox><asp:TextBox
                                                ID="txtEntityId" runat="server" Style="visibility: hidden" Width="147px"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>
                        </ContentTemplate>
                    </asp:TabPanel>
                </asp:TabContainer>
            </asp:Panel>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td class="style1">
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
    </table>
</asp:Content>
